home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / turban_1 / turbanda.cab / SampleDate.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-04-08  |  10.4 KB  |  315 lines

  1. VERSION 5.00
  2. Object = "{680D6CE5-E3BD-11D2-917D-0020AF1BB280}#9.0#0"; "TurbanDateControl.ocx"
  3. Begin VB.Form frmSampleDate 
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "Date Sample"
  6.    ClientHeight    =   5985
  7.    ClientLeft      =   45
  8.    ClientTop       =   330
  9.    ClientWidth     =   5760
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   5985
  14.    ScaleWidth      =   5760
  15.    StartUpPosition =   3  'Windows Default
  16.    Begin VB.Frame fraUnbound 
  17.       Caption         =   "Unbound"
  18.       Height          =   1335
  19.       Left            =   240
  20.       TabIndex        =   13
  21.       Top             =   240
  22.       Width           =   5175
  23.       Begin VB.ComboBox cboFormat 
  24.          Height          =   315
  25.          Left            =   240
  26.          Style           =   2  'Dropdown List
  27.          TabIndex        =   15
  28.          Top             =   840
  29.          Width           =   3255
  30.       End
  31.       Begin VB.CommandButton cmdValidity 
  32.          Caption         =   "Validity Test"
  33.          Height          =   255
  34.          Left            =   3600
  35.          TabIndex        =   2
  36.          Top             =   960
  37.          Width           =   1455
  38.       End
  39.       Begin VB.CommandButton cmdToggleCalendar 
  40.          Caption         =   "Toggle Calendar"
  41.          Height          =   255
  42.          Left            =   3600
  43.          TabIndex        =   4
  44.          Top             =   600
  45.          Width           =   1455
  46.       End
  47.       Begin VB.CommandButton cmdTestSpinOnOff 
  48.          Caption         =   "Toggle Spin"
  49.          Height          =   255
  50.          Left            =   3600
  51.          TabIndex        =   3
  52.          Top             =   240
  53.          Width           =   1455
  54.       End
  55.       Begin VB.CommandButton cmdTestSelText 
  56.          Caption         =   "Select Text"
  57.          Height          =   255
  58.          Left            =   2040
  59.          TabIndex        =   1
  60.          Top             =   240
  61.          Width           =   1455
  62.       End
  63.       Begin TurbanDateControl.TurbanDate TurbanDate1 
  64.          Height          =   315
  65.          HelpContextID   =   101
  66.          Left            =   240
  67.          TabIndex        =   0
  68.          ToolTipText     =   "TurbanDate tooltip"
  69.          Top             =   360
  70.          Width           =   1635
  71.          _ExtentX        =   2884
  72.          _ExtentY        =   556
  73.          Text            =   "3/15/1999"
  74.          TextWidth       =   1335
  75.          SpinLeft        =   1060
  76.          DateFormat      =   "m/d/yyyy"
  77.          BackColor       =   33023
  78.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  79.             Name            =   "MS Sans Serif"
  80.             Size            =   8.25
  81.             Charset         =   0
  82.             Weight          =   400
  83.             Underline       =   0   'False
  84.             Italic          =   0   'False
  85.             Strikethrough   =   0   'False
  86.          EndProperty
  87.          ForeColor       =   16777215
  88.       End
  89.    End
  90.    Begin VB.Frame fraBound 
  91.       Caption         =   "Bound "
  92.       Height          =   1815
  93.       Left            =   240
  94.       TabIndex        =   9
  95.       Top             =   1560
  96.       Width           =   5175
  97.       Begin VB.TextBox txtClient 
  98.          DataField       =   "Client"
  99.          DataSource      =   "datAppointments"
  100.          Height          =   285
  101.          Left            =   120
  102.          TabIndex        =   5
  103.          Top             =   600
  104.          Width           =   1695
  105.       End
  106.       Begin VB.Data datAppointments 
  107.          Caption         =   "Appointment: "
  108.          Connect         =   "Access"
  109.          DatabaseName    =   "C:\dvlp\TurbanDate\DATETIME.MDB"
  110.          DefaultCursorType=   0  'DefaultCursor
  111.          DefaultType     =   2  'UseODBC
  112.          Exclusive       =   -1  'True
  113.          Height          =   315
  114.          Left            =   120
  115.          Options         =   0
  116.          ReadOnly        =   0   'False
  117.          RecordsetType   =   1  'Dynaset
  118.          RecordSource    =   "Appointments"
  119.          Top             =   1200
  120.          Width           =   2655
  121.       End
  122.       Begin VB.CommandButton cmdAdd 
  123.          Caption         =   "Add"
  124.          Height          =   255
  125.          Left            =   3000
  126.          TabIndex        =   7
  127.          Top             =   1200
  128.          Width           =   855
  129.       End
  130.       Begin VB.CommandButton cmdRemove 
  131.          Caption         =   "Remove"
  132.          Height          =   255
  133.          Left            =   3960
  134.          TabIndex        =   8
  135.          Top             =   1200
  136.          Width           =   855
  137.       End
  138.       Begin TurbanDateControl.TurbanDate TurbanDate2 
  139.          DataField       =   "Date"
  140.          DataSource      =   "datAppointments"
  141.          Height          =   315
  142.          Left            =   1920
  143.          TabIndex        =   6
  144.          Top             =   600
  145.          Width           =   1635
  146.          _ExtentX        =   2884
  147.          _ExtentY        =   556
  148.          TextWidth       =   1335
  149.          SpinLeft        =   1060
  150.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  151.             Name            =   "MS Sans Serif"
  152.             Size            =   8.25
  153.             Charset         =   0
  154.             Weight          =   400
  155.             Underline       =   0   'False
  156.             Italic          =   0   'False
  157.             Strikethrough   =   0   'False
  158.          EndProperty
  159.       End
  160.       Begin VB.Label lblCaption 
  161.          Caption         =   "Client:"
  162.          Height          =   255
  163.          Index           =   0
  164.          Left            =   120
  165.          TabIndex        =   12
  166.          Top             =   360
  167.          Width           =   1215
  168.       End
  169.       Begin VB.Label lblCaption 
  170.          Caption         =   "Date:"
  171.          Height          =   255
  172.          Index           =   1
  173.          Left            =   1920
  174.          TabIndex        =   11
  175.          Top             =   360
  176.          Width           =   1215
  177.       End
  178.    End
  179.    Begin VB.ListBox lisActivity 
  180.       Height          =   1815
  181.       Left            =   240
  182.       TabIndex        =   10
  183.       Top             =   3840
  184.       Width           =   5175
  185.    End
  186.    Begin VB.Label lblCaption 
  187.       Caption         =   "Area for debugging: (Double click listbox to clear)"
  188.       Height          =   255
  189.       Index           =   2
  190.       Left            =   240
  191.       TabIndex        =   14
  192.       Top             =   3600
  193.       Width           =   3855
  194.    End
  195. Attribute VB_Name = "frmSampleDate"
  196. Attribute VB_GlobalNameSpace = False
  197. Attribute VB_Creatable = False
  198. Attribute VB_PredeclaredId = True
  199. Attribute VB_Exposed = False
  200. Private Sub cboFormat_Click()
  201. TurbanDate1.DateFormat = cboFormat.ListIndex
  202. End Sub
  203. Private Sub cmdAdd_Click()
  204. If datAppointments.Recordset.RecordCount > 0 Then
  205.     datAppointments.Recordset.Move 0
  206.     datAppointments.Recordset.Requery
  207. End If
  208. With datAppointments.Recordset
  209.     .AddNew
  210.     !client = "** New **"
  211.     !Date = Date
  212.     !Time = Time
  213.     .Update
  214.     .Bookmark = .LastModified
  215.     txtClient.SetFocus
  216. End With
  217. End Sub
  218. Private Sub cmdRemove_Click()
  219. Dim intLastPos As Integer
  220. With datAppointments.Recordset
  221.     intLastPos = .AbsolutePosition
  222.     If .RecordCount > 0 Then
  223.         .Move 0
  224.     Else
  225.         .Requery
  226.     End If
  227.     .Delete
  228.     If .RecordCount = 0 Then
  229.         cmdAdd_Click
  230.         Exit Sub
  231.     End If
  232.     If intLastPos < 1 Then
  233.         .MoveNext
  234.     Else
  235.         .MovePrevious
  236.     End If
  237. End With
  238. End Sub
  239. Private Sub cmdTestSelText_Click()
  240. TurbanDate1.SelStart = 2
  241. TurbanDate1.SelLength = 2
  242. TurbanDate1.SetFocus
  243. End Sub
  244. Private Sub cmdTestSpinOnOff_Click()
  245. TurbanDate1.Spin = Not (TurbanDate1.Spin)
  246. End Sub
  247. Private Sub cmdToggleCalendar_Click()
  248. TurbanDate1.Calendar = Not (TurbanDate1.Calendar)
  249. End Sub
  250. Private Sub cmdValidity_Click()
  251. If TurbanDate1.DateIsValid Then
  252.     lisActivity.AddItem TurbanDate1.Text & " is valid"
  253.     lisActivity.AddItem TurbanDate1.Text & " is not valid"
  254. End If
  255. End Sub
  256. Private Sub datAppointments_Reposition()
  257. Const DAT_CAPTION = "Appointment: "
  258. datAppointments.Caption = DAT_CAPTION & datAppointments.Recordset.AbsolutePosition + 1
  259. End Sub
  260. Private Sub Form_Activate()
  261. datAppointments.RecordsetType = vbRSTypeDynaset
  262. datAppointments.RecordSource = "Select * from [Appointments]"
  263. datAppointments.Refresh
  264. End Sub
  265. Private Sub Form_Load()
  266. cboFormat.AddItem "LeadingZerosCentury"     ' enmDateFormat.LeadingZerosCentury
  267. cboFormat.AddItem "LeadingZerosNoCentury"   'enmDateFormat.LeadingZerosNoCentury
  268. cboFormat.AddItem "NoLeadingZerosCentury"   'enmDateFormat.NoLeadingZerosCentury
  269. cboFormat.AddItem "NoLeadingZerosNoCentury" 'enmDateFormat.NoLeadingZerosNoCentury
  270. cboFormat.ListIndex = TurbanDate1.DateFormat
  271. End Sub
  272. Private Sub lisActivity_DblClick()
  273. lisActivity.Clear
  274. End Sub
  275. Private Sub TurbanDate1_DateChanged()
  276. lisActivity.AddItem "Date changed"
  277. End Sub
  278. Private Sub TurbanDate1_DateError(objErr As ErrObject, strCustom As String)
  279. lisActivity.AddItem "Date Error: " & strCustom
  280. End Sub
  281. Private Sub TurbanDate1_DateInvalid()
  282. lisActivity.AddItem "Date Invalid " & TurbanDate1.Text
  283. End Sub
  284. Private Sub TurbanTime1_GotFocus()
  285. lisActivity.AddItem "Time GotFocus"
  286. End Sub
  287. Private Sub TurbanTime1_TimeChanged()
  288. lisActivity.AddItem "Time changed " & TurbanTime1.Text
  289. End Sub
  290. Private Sub TurbanTime1_TimeError(objErr As ErrObject, strCustom As String)
  291. lisActivity.AddItem "Time Error: " & strCustom
  292. End Sub
  293. Private Sub TurbanTime1_TimeInvalid()
  294. lisActivity.AddItem "Time Invalid"
  295. End Sub
  296. Private Sub TurbanTime2_TimeError(objErr As ErrObject, strCustom As String)
  297. lisActivity.AddItem "Error processing time: " & objErr.Description & "; " & strCustom
  298. TurbanTime2.SetFocus
  299. End Sub
  300. Private Sub TurbanTime2_TimeInvalid()
  301. lisActivity.AddItem "Time is not valid."
  302. TurbanTime2.SetFocus
  303. End Sub
  304. Private Sub TurbanDate2_DateError(objErr As ErrObject, strCustom As String)
  305. lisActivity.AddItem "Error processing date: " & objErr.Description & "; " & strCustom
  306. TurbanDate2.SetFocus
  307. End Sub
  308. Private Sub TurbanDate2_DateInvalid()
  309. lisActivity.AddItem "Date is not valid."
  310. TurbanDate2.SetFocus
  311. End Sub
  312. Private Sub TurbanDate2_DblClick()
  313. lisActivity.AddItem "You double clicked the date field."
  314. End Sub
  315.